package com.sxg.service.impl;

import java.util.List;

import com.sxg.common.annotation.DataSource;
import com.sxg.common.enums.DataSourceType;
import com.sxg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sxg.mapper.GoodsCollectionMapper;
import com.sxg.domain.GoodsCollection;
import com.sxg.service.IGoodsCollectionService;

/**
 * 商品收藏Service业务层处理
 * 
 * @author 浪漫写尽歌谱
 * @date 2024-01-09
 */
@Service
@DataSource(value = DataSourceType.SLAVE)
public class GoodsCollectionServiceImpl implements IGoodsCollectionService 
{
    @Autowired
    private GoodsCollectionMapper goodsCollectionMapper;

    /**
     * 查询商品收藏
     * 
     * @param id 商品收藏主键
     * @return 商品收藏
     */
    @Override
    public GoodsCollection selectGoodsCollectionById(Long id)
    {
        return goodsCollectionMapper.selectGoodsCollectionById(id);
    }

    /**
     * 查询商品收藏列表
     * 
     * @param goodsCollection 商品收藏
     * @return 商品收藏
     */
    @Override
    public List<GoodsCollection> selectGoodsCollectionList(GoodsCollection goodsCollection)
    {
        return goodsCollectionMapper.selectGoodsCollectionList(goodsCollection);
    }

    /**
     * 新增商品收藏
     * 
     * @param goodsCollection 商品收藏
     * @return 结果
     */
    @Override
    public int insertGoodsCollection(GoodsCollection goodsCollection)
    {
        goodsCollection.setCreateTime(DateUtils.getNowDate());
        return goodsCollectionMapper.insertGoodsCollection(goodsCollection);
    }

    /**
     * 修改商品收藏
     * 
     * @param goodsCollection 商品收藏
     * @return 结果
     */
    @Override
    public int updateGoodsCollection(GoodsCollection goodsCollection)
    {
        return goodsCollectionMapper.updateGoodsCollection(goodsCollection);
    }

    /**
     * 批量删除商品收藏
     * 
     * @param ids 需要删除的商品收藏主键
     * @return 结果
     */
    @Override
    public int deleteGoodsCollectionByIds(Long[] ids)
    {
        return goodsCollectionMapper.deleteGoodsCollectionByIds(ids);
    }

    /**
     * 删除商品收藏信息
     * 
     * @param id 商品收藏主键
     * @return 结果
     */
    @Override
    public int deleteGoodsCollectionById(Long id)
    {
        return goodsCollectionMapper.deleteGoodsCollectionById(id);
    }
}
